/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Random;

/**
 * <p>Project: app2022 - Demo
 * <p>Powered by webrx On 2022-01-06 19:09:40
 *
* @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Demo {

    public static void main(String[] args) {

    }

    public static void aa(String[] args) throws ParseException {
        Random rand = new Random();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long start = sdf.parse("2022-01-01 00:00:00").getTime();
        long now = sdf.parse("2022-01-01 23:59:59").getTime();

        for (int i = 0; i < 10; i++) {
            long time = Math.round(rand.nextDouble() * (now - start)) + start;
            System.out.printf("%tF %<tT%n", time);
        }


        //使用Math.random() 方法实现 随机号数 1-15
        //1 - 15   20 - 30
        //long num = Math.round(Math.random() * (30-20)) + 20;
        //Math.random() 0.000000001*5 0.0000005 0
        //0.9999999*5 4.5 5

    }

}
